
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> ve; 
typedef pair<int,int > pii;
#pragma warning(disable:4996)//关闭C语言输入输出检查


int main()
{
	ve a;
	int target;int n;
	cin>>target>>n; 
	a.resize(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a.begin(),a.end()); 
	int cnt=0;
	int left=0;
	int right=n-1;
	while(left<right)
	{
		if(a[left]+a[right]>target)right--;
		else left++,right--;
		cnt++;
	}
	cout<<cnt<<endl; 
	return 0;
}

